# coding:utf8
import urllib.request
from bs4 import BeautifulSoup
#简单（静态页面）爬虫

url = "https://qy.58.com/tj/"
# print('第一个方法')
response1 = urllib.request.urlopen(url)
# print(response1.getcode())
# print(response1.read())

suop = BeautifulSoup(response1,'html.parser',from_encoding='utf-8')
suop1 = suop.find(class_='compInfo bor')
strs = suop1.find_all('a')
for str in strs:
    print(str['href'],str.text)

#测试git1
# print('第二个方法')
# request = urllib.request.DataHandler("user-agent","Mozilla/5.0")
# response2 = urllib.request.urlopen(request)
# print(response2.getcode)
# print(response2.read())

